import time

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()  # 使用chrome的浏览器驱动
driver.get("https://www.baidu.com")
driver.maximize_window()
driver.find_element(By.CSS_SELECTOR,"input#kw").send_keys("张翰")
driver.find_element(By.XPATH,'//input[@id="su"]').click()
time.sleep(2)
driver.save_screenshot("../搜索结果已保存.png")
# 获取本地缓存中CVStringTimestamp字段值
driver.execute_script('return localStorage.getItem("CVStringTimestamp")')
driver.quit()